from libs.exception import BaseHTTPException
from flask_babel import gettext as _

class FileTooLargeError(BaseHTTPException):
    error_code = "file_too_large"
    code = 413
    def __init__(self, message:str=""):
        self.description = _("File size exceeded. {message}").format(message=message)
        super().__init__(self.description)


class UnsupportedFileTypeError(BaseHTTPException):
    error_code = "unsupported_file_type"
    description = "File type not allowed."
    code = 415
    def __init__(self,):
        self.description = _("File type not allowed.")
        super().__init__(self.description)


class TooManyFilesError(BaseHTTPException):
    error_code = "too_many_files"
    description = "Only one file is allowed."
    code = 400
    def __init__(self,):
        self.description = _("Only one file is allowed.")
        super().__init__(self.description)


class NoFileUploadedError(BaseHTTPException):
    error_code = "no_file_uploaded"
    description = "Please upload your file."
    code = 400
    def __init__(self,):
        self.description = _("Please upload your file.")
        super().__init__(self.description)